package cn.yejinwen.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import cn.chenjifeng.model.OrderModel;
import cn.common.tool.seach;
import cn.hanxiaojun.model.Desk;
import cn.xiezonjie.model.Menu;
import cn.yejinwen.dao.OrderDao;
import cn.yejinwen.model.Desk_id;
import cn.yejinwen.model.Order;

public class SelectDeskImpl implements OrderDao{
	
    public ArrayList<Desk_id> QueryDesk() throws SQLException{ //查询空闲的餐桌id
    	  @SuppressWarnings("rawtypes")
		ArrayList list=new ArrayList<Desk_id>();
       try{
    	  
        	
			String sql="select * from desk where t_status='1'";
        	seach query=new seach();
        	ResultSet rs=query.f(sql);
        	
        	while(rs!=null&&rs.next()){ 
        		Desk desk=new Desk();
        		desk.setT_id(rs.getString("t_id"));
        		desk.setT_status(rs.getString("t_status"));
        		
        		list.add(desk);
        	}
        
       	 		
        	}catch(SQLException e){
        		e.printStackTrace();
        	}
        	
        	return list;
        }

	public ArrayList<Desk_id> showUseing_Desk() throws SQLException{   //查询使用中的餐桌id
		
		ArrayList list=new ArrayList<Desk_id>();
	       try{
	    	   
	    	   String sql="select * from desk where t_status='0'";
	        	seach query=new seach();
	        	ResultSet rs=query.f(sql);
	        	
	        	while(rs!=null&&rs.next()){ 
	        		Desk desk=new Desk();
	        		desk.setT_id(rs.getString("t_id"));
	        		desk.setT_status(rs.getString("t_status"));
	        		
	        		list.add(desk);
	        	}
	        
	       	 		
	        	
	        }catch(Exception e){
		    	   System.out.println(e+"--------");
		       }
			
	    	   return list;
	       }	
}
